package com.txc.openfeign.common.pay.factory;


import com.txc.openfeign.common.pay.api.AliPayLifeFeign;
import com.txc.openfeign.common.pay.vo.NotifyFileVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName: AliPayLifeFeignFallbackFactory
 * @Author: TXC
 * @Date: 2022-01-26 10:59
 **/
@Component
public class AliPayLifeFeignFallbackFactory implements FallbackFactory<AliPayLifeFeign> {
    private static final Logger log = LoggerFactory.getLogger(AliPayLifeFeignFallbackFactory.class);
    @Override
    public AliPayLifeFeign create(Throwable cause) {
        log.error("获取文件失败: {}", cause.getMessage());
        return new AliPayLifeFeign() {
            @Override
            public void reconciliation(String filePath, String fileName) {
                throw new RuntimeException("获取文件失败");
            }

            @Override
            public NotifyFileVo analysisNotifyFile(String filePath, String fileName) {
                throw new RuntimeException("获取文件失败");
            }
        };
    }
}
